function [randomdraw, para_income] = gen_randomdraw(para_nonlinear,...
    n_x_rand, randomdraw0, is_transformed)

if is_transformed
    para_sigma = para_nonlinear(1:n_x_rand+1);
    sigma_matrix = diag(para_sigma);    

    corr_light_craft = para_nonlinear(n_x_rand+2);    
    sigma_matrix(2, 3) = corr_light_craft;    

    randomdraw = sigma_matrix * randomdraw0;    
    para_income = para_nonlinear(n_x_rand+3);    
else
    para_sigma = exp(para_nonlinear(1:n_x_rand+1));
    sigma_matrix = diag(para_sigma);
    
    corr_light_craft = para_nonlinear(n_x_rand+2);    
    sigma_matrix(2, 3) = corr_light_craft;
    
    randomdraw = sigma_matrix * randomdraw0;    
    para_income = para_nonlinear(n_x_rand+3);    
end


